﻿

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IotClientService.Models.Lg;

/// <summary>
/// 充放电步次数据
/// </summary>
public class LgFmtStep
{
    /// <summary>
    /// 步骤编号
    /// </summary>
    public int Step { get; set; } = 1;

    /// <summary>
    /// 1: 恒流充电(CC)，2: 恒压充电(CV)，3 : 恒流恒压充电(CCCV) 4: 恒流放电（CD），5: REST 6：恒流恒压放电（CCDV）
    /// </summary>
    public int ConstantCurrentCharge { get; set; } = 5;





    /// <summary>
    /// 正电压值，单位毫伏
    /// </summary>
    public double? PositiveVoltage { get; set; } = 9999.99;

    /// <summary>
    /// 正电流值，单位毫安
    /// </summary>
    public double? PositiveCurrent { get; set; } = 9999.99;

    /// <summary>
    /// 时间，单位分钟
    /// </summary>
    public double? Time { get; set; } = 1;
    /// <summary>
    /// 负压
    /// </summary>
    public double? Pressure { get; set; } = 99;

    /// <summary>
    /// 终止电压值，单位毫伏
    /// </summary>
    public double? TerminationVoltage { get; set; } = 9999.99;

    /// <summary>
    /// 终止电流值，单位毫安
    /// </summary>
    public double? TerminationCurrent { get; set; } = 9999.99;

    /// <summary>
    /// 终止容量值，单位毫安
    /// </summary>
    public double? TerminationCapacity { get; set; } = 9999.99;
    /// <summary>
    /// 负压偏差
    /// </summary>
    public double? SubPressure { get; set; } = 99;
    /// <summary>
    /// 温度下限
    /// </summary>
    public double? TempMin { get; set; } = 99;
    /// <summary>
    /// 温度上限
    /// </summary>
    public double? TempMax { get; set; } = 99;

    /// <summary>
    /// 重写ToString方法，连接各个属性的值，且属性的长度为首数字
    /// </summary>
    /// <returns></returns>
    public override string ToString()
    {
        return $"{Step.ToString().PadLeft(2, '0')}" +
               $"{ConstantCurrentCharge.ToString().PadLeft(1, '0')}" +

               $"{PositiveVoltage.ToString().PadLeft(7, '0')}" +
               $"{PositiveCurrent.ToString().PadLeft(9, '0')}" +
               $"{Time.ToString().PadLeft(5, '0')}" +
               $"{Pressure.ToString().PadLeft(3, '0')}" +
               $"{TerminationVoltage.ToString().PadLeft(7, '0')}" +
               $"{TerminationCurrent.ToString().PadLeft(9, '0')}" +
               $"{TerminationCapacity.ToString().PadLeft(9, '0')}" +

               $"{SubPressure.ToString().PadLeft(3, '0')}" +
               $"{TempMin.ToString().PadLeft(3, '0')}" +
               $"{TempMax.ToString().PadLeft(3, '0')}";

    }
}



